/*
 ID: cherish2
 LANG: JAVA
 PROG: friday
 */

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

public class friday {

	public static void main(String[] args) throws IOException {

		BufferedReader reader = new BufferedReader(new FileReader("friday.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"friday.out")));

		String text = reader.readLine();
		int N = Integer.parseInt(text);
		int year = 1900 + N - 1;

		String[] weeks = { "Monday", "Tuesday", "Wednesday", "Thursday",
				"Friday", "Saturday", "Sunday" };
		
		Map<String, Integer> weekMap = new HashMap<String, Integer>();
		weekMap.put("Monday", 0);
		weekMap.put("Tuesday", 1);
		weekMap.put("Wednesday", 2);
		weekMap.put("Thursday", 3);
		weekMap.put("Friday", 4);
		weekMap.put("Saturday", 5);
		weekMap.put("Sunday", 6);

		Map<String, Integer> resultMap = new HashMap<String, Integer>();
		for (int i = 0; i < weeks.length; i++) {
			resultMap.put(weeks[i], 0);
		}

		String year_begin = "Monday";
		String Thirteenth = null;
		String month_begin = "Monday";
		int year_days = 0;
		int month_days = 0;
		for (int i = 1900; i <= year; i++) {
			if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
				// this is a leap year,so feburary has 29 days.
				year_days = 366;
				int bb = weekMap.get(year_begin);
				for (int j = 1; j <= 12; j++) {
					if(j == 4 || j == 6 || j == 9 || j == 11){
						month_days = 30;
						int c = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + c) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[(month_days % 7 + c) % 7]; //the first day of the next month
					}else if(j == 2){
						month_days = 29;
						int b = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + b) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[(month_days % 7 + b) % 7]; //the first day of the next month						
					}else{
						month_days = 31;
						int a = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + a) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[(month_days % 7 + a) % 7]; //the first day of the next month 					
					}
					year_begin = weeks[(year_days % 7 + bb) % 7];
				}

			} else {// this is a common year, so feburary has 28 days.
				year_days = 365;
				int aa = weekMap.get(year_begin);
				
				for (int j = 1; j <= 12; j++) {
					if(j == 4 || j == 6 || j == 9 || j == 11){
						month_days = 30;
						int c = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + c) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[(month_days % 7 + c) % 7]; //the first day of the next month
					}else if(j == 2){
						month_days = 28;
						int b = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + b) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[month_days % 7 + b]; //the first day of the next month						
					}else{
						month_days = 31;
						int a = weekMap.get(month_begin);
						Thirteenth = weeks[(13 % 7 - 1 + a) % 7];
						int value = resultMap.get(Thirteenth);
						resultMap.put(Thirteenth, value + 1);
						month_begin = weeks[(month_days % 7 + a) % 7]; //the first day of the next month 					
					}
				}
				
				year_begin = weeks[(year_days % 7 + aa) % 7];
			}
		}

		out.println(resultMap.get("Saturday") + " " + resultMap.get("Sunday") + " "
				  + resultMap.get("Monday") + " " + resultMap.get("Tuesday") + " "
				  + resultMap.get("Wednesday") + " " + resultMap.get("Thursday") + " " 
				  + resultMap.get("Friday"));
		out.close();
		System.exit(0);
	}
}
